<%@ page errorPage="/error.jsp" pageEncoding="UTF-8" %>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%>

<html lang="en">


<head>

	<title>IP DataManager</title>
	<meta charset="utf-8">
	
	<!-- Combined stylesheets load -->
	<link href="<spring:url value="/resources/styles/themes/admin/css/mini74d5.css?files=reset,common,form,standard,special-pages" />" rel="stylesheet" type="text/css">
	
	<!-- Favicon -->
	<link rel="shortcut icon" type="image/x-icon" href="favicon.ico">
	<link rel="icon" type="image/png" href="favicon-large.png">
	
	<!-- Combined JS load -->
	<!-- html5.js has to be loaded before anything else -->
	<script type="text/javascript" src="<spring:url value="/resources/styles/themes/admin/js/mini635d.js?files=html5,jquery-1.4.2.min,old-browsers,common,standard,jquery.tip.js" />" ></script>
	<!--[if lte IE 8]><script type="text/javascript" src="js/standard.ie.js"></script><![endif]-->
	
	<!-- example login script -->
	<script type="text/javascript">
	
		$(document).ready(function()
		{
			// We'll catch form submission to do it in AJAX, but this works also with JS disabled
			$('#login-form').submit(function(event)
			{
				// Stop full page load
				event.preventDefault();
				
				// Check fields
				var login = $('#login').val();
				var pass = $('#pass').val();
				
				if (!login || login.length == 0)
				{
					$('#login-block').removeBlockMessages().blockMessage('Nhập tên tài khoản !', {type: 'warning'});
				}
				else if (!pass || pass.length == 0)
				{
					$('#login-block').removeBlockMessages().blockMessage('Nhập mật khẩu !', {type: 'warning'});
				}
				else
				{
					var submitBt = $(this).find('button[type=submit]');
					submitBt.disableBt();
					
					// Target url
					var target = "<spring:url value='/account/authenticate.htm' />";
					if (!target || target == '')
					{
						// Page url without hash
						target = document.location.href.match(/^([^#]+)/)[1];
					}
					
					// Request
					var data = {
						userName: login,
						pwd: pass
					};
					var redirect = $('#redirect');
					if (redirect.length > 0)
					{
						data.redirect = redirect.val();
					}
					
					// Send
					$.ajax({
						type: 'POST',
						url: target +'?userName='+login+'&pwd='+pass+'',
// 						dataType: 'json',
						
// 						data: data,
						success: function(result) {
							if (result == true) {
								document.location.href = "<spring:url value='/account/home.htm'/>";
							} else if (result == "") {
								$('#login-block').removeBlockMessages().blockMessage('Lỗi kết nối tới máy chủ, vui lòng thử lại', {type: 'error'});
								submitBt.enableBt();
							}else {
								// Message
								$('#login-block').removeBlockMessages().blockMessage('Tài khoản hoặc Mật khẩu sai, vui lòng thử lại !', {type: 'error'});
								
								submitBt.enableBt();
							}
						},
						error: function() {
							// Message
							$('#login-block').removeBlockMessages().blockMessage('Lỗi kết nối tới máy chủ, vui lòng thử lại', {type: 'error'});
							
							submitBt.enableBt();
						}
					});
					
					// Message
					$('#login-block').removeBlockMessages().blockMessage('Vui lòng đợi, đang kiểm tra ...', {type: 'loading'});
				}
			});
		});
	
	</script>
	
	<!--
	
	This file is from the demo website of the Constellation Admin Skin
	
	If you like it and wish to use it, please consider buying it on ThemeForest:
	http://themeforest.net/item/constellation-complete-admin-skin/116461
	
	Thanks!
	
	-->
	
</head>

<!-- the 'special-page' class is only an identifier for scripts -->
<body class="special-page login-bg dark">
<!-- The template uses conditional comments to add wrappers div for ie8 and ie7 - just add .ie, .ie7 or .ie6 prefix to your css selectors when needed -->
<!--[if lt IE 9]><div class="ie"><![endif]-->
<!--[if lt IE 8]><div class="ie7"><![endif]-->

<!-- 	<section id="message"> -->
<!-- 		<div class="block-border"><div class="block-content no-title dark-bg"> -->
<!-- 			<p class="mini-infos">For demo website, use <b>admin</b> / <b>admin</b></p> -->
<!-- 		</div></div> -->
<!-- 	</section> -->
	
	<section id="login-block">
		<div class="block-border"><div class="block-content">
				
			<h1>Đăng nhập</h1>
			<div class="block-header">IP DataManager</div>
				
			<form class="form with-margin" name="login-form" id="login-form" method="post" action="#">
				<input type="hidden" name="a" id="a" value="send">
				<p class="inline-small-label">
					<label for="login"><span class="big">Tài khoản</span></label>
					<input type="text" name="login" id="login" class="full-width" value="">
				</p>
				<p class="inline-small-label">
					<label for="pass"><span class="big">Mật khẩu</span></label>
					<input type="password" name="pass" id="pass" class="full-width" value="">
				</p>
				
				<button type="submit" class="float-right">Đăng nhập</button>
				<p class="input-height">
					<input type="checkbox" name="keep-logged" id="keep-logged" value="1" class="mini-switch" checked="checked">
					<label for="keep-logged" class="inline">Duy trì đăng nhập</label>
				</p>
			</form>
			
			<form class="form" id="password-recovery" method="post" action="#">
				<fieldset class="grey-bg no-margin collapse">
					<legend><a href="#">Quên mật khẩu ?</a></legend>
					<p class="input-with-button">
						<label for="recovery-mail">Nhập địa chỉ Email đăng ký</label>
						<input type="text" name="recoveryMail" id="recoveryMail" value="">
						<button type="button">Gửi</button>
					</p>
				</fieldset>
			</form>
		</div></div>
	</section>

<!--[if lt IE 8]></div><![endif]-->
<!--[if lt IE 9]></div><![endif]-->
<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-10643639-3']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>
</body>


</html>
